﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Phoenix.Xna.Framework.FrameworkExtensions;

namespace Phoenix.Xna.Framework
{
    public class ConversionHelper
    {
        public static object Convert(Type type, object value)
        {
            if (type == typeof(Int16))
            {
                return Int16.Parse(value.ToString());
            }
            else if (type == typeof(Int32))
            {
                return Int32.Parse(value.ToString());
            }
            else if (type == typeof(Int64))
            {
                return Int64.Parse(value.ToString());
            }
            else if (type == typeof(Single))
            {
                return Single.Parse(value.ToString());
            }
            else if (type == typeof(Double))
            {
                return Double.Parse(value.ToString());
            }

            return value;
        }
    }
}
